<?php
require_once dirname(__FILE__) . '/includes/common.inc.php';
require_once dirname(__FILE__) . "/database/$database/database.inc.php";

header('Content-Type: text/plain');

global $myManager;

try {
  $hostname = HOST_NAME;
  $username = USER_NAME2;
  $password = PASSWORD2;
  $dbname = DATABASE_NAME2;
  $myPdo = new PDO ('mysql:host=' . $hostname, $username, $password);
  $myPdo->exec('USE ' . $dbname);
  $myPdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

} catch (PDOException $e) {
  echo $e->getMessage ();
}

try {
  $sql = "update ns_produce as p set p.deadline = p.deadline + 18000 where p.deadline != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_produce as p set p.when = p.when + 18000 where p.when != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_produce as p set p.date = p.date + 18000 where p.date != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_produce as p set p.createdDate = p.createdDate + 18000 where p.createdDate != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_produce as p set p.sentDate = p.sentDate + 18000 where p.sentDate != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_produce as p set p.receivedDate = p.receivedDate + 18000 where p.receivedDate != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_produceevent as pe set pe.date = pe.date + 18000 where pe.date != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_producenote as pn set pn.date = pn.date + 18000 where pn.date != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_producetrack as pt set pt.deadline = pt.deadline + 18000 where pt.deadline != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_producetrack as pt set pt.when = pt.when + 18000 where pt.when != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_producetrack as pt set pt.date = pt.date + 18000 where pt.date != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_producetrack as pt set pt.createdDate = pt.createdDate + 18000 where pt.createdDate != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_producetrack as pt set pt.sentDate = pt.sentDate + 18000 where pt.sentDate != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  $sql = "update ns_producetrack as pt set pt.receivedDate = pt.receivedDate + 18000 where pt.receivedDate != 0";
  $stmt = $myPdo->prepare($sql);
  $stmt->execute();
  
  echo json_encode(array());
} catch (PDOException $e) {
  echo $e->getMessage();
}
?>